<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>登录</title>
    <link rel="stylesheet" href="fonts-materal/css/material-design-iconic-font.min.css">
    <link rel="stylesheet" href="css/style.css">
    <script src="https://unpkg.com/coco-message/coco-message.min.js"></script>
    <link rel="shortcut icon" href="https://static.arkread.com/ark/pics/favicon/favicon.ba37640e.ico" type="image/x-icon"/>
    <link rel="mask-icon" href="https://static.arkread.com/ark/pics/favicon/safari-mask-icon.714e3ee0.svg" color="#5795aa"/>
</head>
<body>
<div class="main">
    <!-- Sing in  Form -->
    <section class="sign-in">
        <div class="container">
            <div class="signin-content">
                <div class="signin-image">
                    <figure>
                        <img src="images/signin-image.jpg" alt="sing up image">
                    </figure>
                    <a href="registration.jsp" class="signup-image-link">无账户？去创建</a>
                </div>
                <div class="signin-form">
                    <h2 class="form-title">登&nbsp;录</h2>
                    <form method="post" action="/login" class="register-form" id="login-form">
                        <div class="form-group">
                            <label for="username"><i
                                    class="zmdi zmdi-account material-icons-name"></i></label> <input
                                type="text" name="username" id="username"
                                placeholder="用户名"/>
                        </div>
                        <div class="form-group1">
                            <label for="password"><i class="zmdi zmdi-lock"></i></label> <input
                                type="password" name="password" id="password"
                                placeholder="密码"/>
                        </div>
                        <div class="contain">
                            <div class="contain-all">
                                <a href="no-password.jsp" class="a-forget">免密登录</a>
                            </div>
                            <div class="contain-all"></div>
                            <div class="contain-all"></div>
                            <div class="contain-all">
                                <a href="forget.jsp" class="a-forget">忘记密码？</a>
                            </div>
                        </div>
                        <div class="form-group">
                            <input type="checkbox" name="remember-me" id="remember-me"
                                   class="agree-term"/> <label for="remember-me"
                                                               class="label-agree-term"><span><span></span></span>记住用户名和密码</label>
                        </div>
                        <div class="form-group form-button">
                            <input type="submit" name="signin" id="signin"
                                   class="form-submit" value="登录"/>
                        </div>
                    </form>
                    <div class="social-login">
                        <span class="social-label">使用其他方式登录</span>
                        <ul class="socials">
                            <li><a href="#"><i
                                    class="display-flex-center zmdi zmdi-facebook"></i></a></li>
                            <li><a href="#"><i
                                    class="display-flex-center zmdi zmdi-twitter"></i></a></li>
                            <li><a href="#"><i
                                    class="display-flex-center zmdi zmdi-google"></i></a></li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </section>
</div>
<script type="text/javascript" src="js/main.js"></script>
<script>
    const username = '<%=request.getSession().getAttribute("username")%>';
    const error = '<%=request.getParameter("error")%>';
    const su = '<%=request.getParameter("BinGo")%>'
    document.getElementById('login-form').addEventListener('submit',function (event){
        if(error==='forbid'){
            event.preventDefault();
            cocoMessage.error('账号已被封禁');
        }
    })
    if (error === 'fail') {
       cocoMessage.error('账号密码错误');
    }
    if (error === 'pleLogin') {
       cocoMessage.error('请先注册')
    }
    if (su === 'success') {
        alert('注册成功，即将为您跳转到登陆页')
    }
</script>
</body>
</html>